home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / MMScriptEng.Cab / F115585_scaleby.mm < prev    next >
Encoding:
Text File  |  2001-12-07  |  1.1 KB  |  27 lines

  1. // Scale layers by comp size - version 1.0
  2.  
  3. // This script will scale all layers in the comp by the scale_factor, below.
  4. // It rescales position and scale. This is particularly useful if you resize a
  5. // comp, and want to scale all of your objects to fit its new dimensions.
  6.  
  7. //      LAYER                                               PROPERTY                     CHANNEL
  8. //      ------                                              ----------                     --------
  9. // 1: doesn't matter                               doesn't matter               doesn't matter
  10. // 2: doesn't matter                               doesn't matter               doesn't matter
  11.  
  12. if (time() == start_time) {
  13.     original_comp_dimensions = {320,240};   // change this to comp size before scaling
  14.     new_comp_dimensions = {160,120};          // change this to comp size after scaling
  15.  
  16.     scale_factor = (new_comp_dimensions / original_comp_dimensions);
  17. }
  18.  
  19. l = 1;
  20. while (l <= num_layers) {       // loop over every layer
  21.  
  22.         value(l, position) = value(l, position) * scale_factor;
  23.         value(l, scale) = value(l, scale) * scale_factor;
  24.  
  25.   l = l+1;
  26. }
  27.